<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="resources/file-drag-common.js"></script>
<form  method="GET">
<input onchange="changeCount++;" type="file" id="file1">
</form>
<script>
var changeCount;
test(() => {
  var file1 = document.getElementById('file1');
  dragFilesOntoInput(file1, ['file-cloneNode.html']);
  changeCount = 0;
  var clone = file1.cloneNode(true);
  assert_equals(file1.value, 'C:\\fakepath\\file-cloneNode.html');
  assert_equals(clone.value, 'C:\\fakepath\\file-cloneNode.html');
  // Test for crbug.com/388795.
  assert_equals(changeCount, 0);

  // Make sure two file input don't share their values.
  document.body.appendChild(clone);
  dragFilesOntoInput(file1, ['resources/file-drag-common.js']);
  assert_equals(file1.value, 'C:\\fakepath\\file-drag-common.js');
  assert_equals(clone.value, 'C:\\fakepath\\file-cloneNode.html');
}, 'Make sure that Node.cloneNode() works as expected for file input type.');
</script>
</body>
</html>
